import request from '@/api/request'
// 登录
/* 二维码登录 */
// 获取二维码key
export const getQrKey = () => request({ url: '/login/qr/key', params: { timerstamp: new Date().getTime() } })
// 生成二维码Base 64
export const createQr = (key, qrimg = true) => request({ url: '/login/qr/create', params: { key, qrimg, timestamp: Date.now() }, method: 'get' })
// 轮询二维码状态 800 为二维码过期,801 为等待扫码,802 为待确认,803 为授权登录成功(803 状态码下会返回 cookies)
export const checkQr = (key) => request({ url: '/login/qr/check', params: { key, timestamp: Date.now() }, method: 'get' })
/* 获取登录状态 */
export const getLoginStatus = () => request({ url: '/login/status', method: 'get' })
// 获取用户详情
export const getuserDetail = (uid) => request({ url: '/user/detail', params: { uid } })
// 获取账号信息
export const getUserAccount = () => request({ url: '/user/account', method: 'get' })
// 获取用户信息 , 歌单，收藏，mv, dj 数量
export const getUserSubcount = () => request({ url: '/user/subcount', method: 'get' })
// 获取用户等级信息
export const getUserLevel = () => request({ url: '/user/level', method: 'get' })
// 获取用户绑定信息
export const getUserBinding = (uid) => request({ url: '/user/binding', params: { uid }, method: 'get' })
// 获取用户歌单
export const getUserPlaylist = (uid, offset, limit = 30) => request({ url: '/user/playlist', params: { uid, offset, limit }, method: 'get' })
// 用户喜欢音乐id
export const getLikelist = (uid) => request({ url: '/likelist', params: { uid }, method: 'get' },)
// 用户喜欢音乐
export const getLike = (id, like = true) => request({ url: '/like', params: { id, like, timestamp: Date.now() }, method: 'get' })
// 退出登录
export const getLogout = () => request({ url: '/logout', method: 'get' })